<?php
$params = array(
	'pagination' => false,
	'pagination_id' => 'pagination_contents',
	'show_sort_by' => true,
	'show_view_layout' => true,
	'sortby' => 'timestamp',
	'sortdir' => 'desc',
	'view_type' => 'list',
	'paging_text' => 'Displaying from <strong>%s - %s</strong> in <strong>%s</strong> total',
);

extract($params, EXTR_SKIP);

$sort_items = array(
	'show_option_none' => t('Sort by'),
	'selected' => sprintf('%s_%s', $sortby, $sortdir),
	'rev' => $pagination_id,
	'items' => array(
		'timestamp_desc' => array(
			'label' => t('From new to old'),
			'href' => add_query_arg(array('sortby' => 'timestamp', 'sortdir' => 'desc')),
			'class' => 'cm-ajax',
		),
		'timestamp_asc' => array(
			'label' => t('From old to new'),
			'href' => add_query_arg(array('sortby' => 'timestamp', 'sortdir' => 'asc')),
			'class' => 'cm-ajax',
		),
		'name_asc' => array(
			'label' => t('Title: from A to Z'),
			'href' => add_query_arg(array('sortby' => 'name', 'sortdir' => 'asc')),
			'class' => 'cm-ajax',
		),
		'name_desc' => array(
			'label' => t('Title: from Z to A'),
			'href' => add_query_arg(array('sortby' => 'name', 'sortdir' => 'desc')),
			'class' => 'cm-ajax',
		)
	),
);

$this->renderPartial('//common/sortings', compact('sort_items', array_keys($params)));